package com.blunka.framework.client.ui.swing;

import javax.swing.JComboBox;

import com.blunka.framework.client.enums.ModelField;
import com.blunka.framework.client.enums.ModelStates;
import com.blunka.framework.client.enums.ModelStatus;
import com.blunka.framework.client.enums.ModelType;

public class BlkJComboBox<E> extends JComboBox<E>{

	public void setSelectedValue(ModelType v){
		for(int i=0;i<this.getItemCount();i++){
			ModelType c = ModelType.getEnum(this.getItemAt(i).toString());
			if(c == v){
				this.setSelectedIndex(i);
				break;
			}
		}
	}

	public void setSelectedValue(ModelStates v){
		for(int i=0;i<this.getItemCount();i++){
			ModelStates c = ModelStates.getEnum(this.getItemAt(i).toString());
			if(c == v){
				this.setSelectedIndex(i);
				break;
			}
		}
	}

	public void setSelectedValue(ModelStatus v){
		for(int i=0;i<this.getItemCount();i++){
			ModelStatus c = ModelStatus.getEnum(this.getItemAt(i).toString());
			if(c == v){
				this.setSelectedIndex(i);
				break;
			}
		}
	}

	public void setSelectedValue(ModelField v){
		for(int i=0;i<this.getItemCount();i++){
			ModelField c = ModelField.getEnum(this.getItemAt(i).toString());
			if(c == v){
				this.setSelectedIndex(i);
				break;
			}
		}
	}
}
